package de.koller.worlders.gameplay;

import de.koller.oceanFramework.tree.Child;
import de.koller.worlders.WSea;
import de.koller.worlders.engine.entity.mo.PlayerPoints;
import de.koller.worlders.gameplay.ability.*;

public class GameplayPlayer extends WSea {
	
	@Child public final PlayerPoints playerPoints = new PlayerPoints();
	@Child public final AbilityBar abilityBar = new AbilityBar();
	
	@Child public final PlayerAbilityRoot playerAbility = new PlayerAbilityRoot();

	private IGameplayPlayerObject gpo;
			
	@Override
	protected void init() {
		super.init();
		
		playerAbility.addAbility( new NoAbility() );
		playerAbility.addAbility( new MineAbility() );
		playerAbility.addAbility( new EncAbility() );
	}

	public void setGPO( IGameplayPlayerObject gpo ) {
		assert gpo == null || this.gpo == null;
		this.gpo = gpo;
	}

	public IGameplayPlayerObject getGPO() {
		return gpo;
	}
	
	public void spawnPlayer( float x, float y ) {
		gpo.getAABB().getPosition().set( x, y );
		gpo.getEnergy().set( 0, 0 );
	}
	
}
